//
//  MAPYModel.swift
//  Mars Proxy
//
//  Created by PowerfullClean on 2023/10/16.
//

import UIKit
import ObjectMapper

enum MAPYNetType: NSInteger {
    case mapy_none = 0
    case mapy_wifi
    case mapy_cellular
    
}

enum MAPYSettingType: NSInteger {
    case mapy_rate = 0
    case mapy_share
    case mapy_privacy
}

enum MAPYFuncType: NSInteger {
    case mapy_connect = 0
    case mapy_disConnect
    case mapy_speed
    case mapy_ip
    var mapy_title:String {
        switch self {
        case .mapy_speed:
            return "Speed test"
        case .mapy_ip:
            return "IP information"
        default:
            return ""
        }
    }
}

@objc enum MAPYVpnStateType: NSInteger {
    /** @const NEVPNStatusInvalid The VPN is not configured. */
    case mapy_invalid = 0

    /** @const NEVPNStatusDisconnected The VPN is disconnected. */
    case mapy_disconnected = 1

    /** @const NEVPNStatusConnecting The VPN is connecting. */
    case mapy_connecting = 2

    /** @const NEVPNStatusConnected The VPN is connected. */
    case mapy_connected = 3

    /** @const NEVPNStatusReasserting The VPN is reconnecting following loss of underlying network connectivity. */
    case mapy_reasserting = 4

    /** @const NEVPNStatusDisconnecting The VPN is disconnecting. */
    case mapy_disconnecting = 5
    var mapy_title:String {
        switch self {
        case .mapy_invalid:
            return "mapy_invalid"
        case .mapy_disconnected:
            return "mapy_disconnected"
        case .mapy_connecting:
            return "mapy_connecting"
        case .mapy_connected:
            return "mapy_connected"
        case .mapy_reasserting:
            return "mapy_reasserting"
        case .mapy_disconnecting:
            return "mapy_disconnecting"
        default:
            return ""
        }
    }
}

enum MAPYVPNStateClickType: NSInteger {
    case mapy_none = 0
    case mapy_connect 
    case mapy_disConnect
    case mapy_disAndConnect
}

struct MAPYSettingModel {
    var mapy_type: MAPYSettingType = .mapy_rate
    var mapy_title: String = ""
    var mapy_icon: String = ""
}
//MARK: - mapy result func
struct MAPYFuncModel {
    var mapy_type: MAPYFuncType = .mapy_speed
    var mapy_title: String = ""
    var mapy_icon: String = ""
}
//MARK: - mapy ip
class MAPYIPScanModel: NSObject, Mappable, Codable {
    var mapy_city: String = ""
    var mapy_country: String = ""
    var mapy_loction: String = ""
    var mapy_region: String = ""
    override init() {
        
    }
    required init?(map: Map) {}
    func mapping(map: Map) {
        mapy_city    <- map["city"]
        mapy_loction         <- map["loc"]
        mapy_country      <- map["country"]
        mapy_region       <- map["region"]
    }
}
//MARK: - mapy speed
class MAPYSpeedValueModel: NSObject {
    var mapy_download: String = ""
    var mapy_upload: String = ""
    var mapy_ping: String = ""
    var mapy_loss: String = ""
    var mapy_jitter: String = ""
    
}

//MARK: - mapy vpn
class MAPYVPNRequestModel : NSObject, Mappable, Codable {
    var mapy_vzdgw: NSInteger = 0
    var mapy_crkZQ:MAPYVPNResContentModel = MAPYVPNResContentModel()
    override init() {
        
    }
    required init?(map: Map) {}
    func mapping(map: Map) {
        mapy_vzdgw    <- map["Vzdgw"]
        mapy_crkZQ    <- map["crkZQ"]
    }
}

class MAPYVPNResContentModel : NSObject, Mappable, Codable {
    var mapy_lAoKn: String = "" //用户名
    var mapy_wxFdL: String = "" //密码
    var mapy_eksjN: Int = 0 //开始端口
    var mapy_zRfuV: Int = 0 //结束端口
    var mapy_qlHTP:[MAPYVPNResServerModel] = [MAPYVPNResServerModel]()
    override init() {
        
    }
    required init?(map: Map) {}
    func mapping(map: Map) {
        mapy_lAoKn    <- map["LAoKn"]
        mapy_wxFdL    <- map["wxFdL"]
        mapy_eksjN    <- map["eksjN"]
        mapy_zRfuV    <- map["ZRfuV"]
        mapy_qlHTP    <- map["qlHTP"]
    }
}

class MAPYVPNResServerModel : NSObject, Mappable, Codable {
    var mapy_bTuIq: String = "" //地址
    var mapy_cTvsK: String = "" //国家
    var mapy_pingValue: NSInteger = 0
    var mapy_select: Bool = false
    override init() {
        
    }
    required init?(map: Map) {}
    func mapping(map: Map) {
        mapy_bTuIq    <- map["BTuIq"]
        mapy_cTvsK    <- map["cTvsK"]
        mapy_pingValue    <- map["mapy_pingValue"]
        mapy_select    <- map["mapy_select"]
    }
}
